package love.yuanmengrobot.guoyitang.controller;
/*
 *   @Studio:CHJY · 源梦科技
 *   @Author:CHJY创幻
 *   @Ide:IntelliJ IDEA
 *   @Creation time:2021/8/13 9:57
 */

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import love.yuanmengrobot.guoyitang.service.MyRegisterService;
import love.yuanmengrobot.guoyitang.utils.DataGridView;
import love.yuanmengrobot.guoyitang.vo.MyRegisterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@CrossOrigin
@Slf4j
public class MyRegisterController {

    @Autowired
    MyRegisterService myRegisterService;

    /**
     *  我的挂号查询
     */
    @GetMapping("/myRegisters")
    public DataGridView selectMyRegister(Integer page, Integer size, String itemcode){
        System.out.println(page+":"+size+":"+itemcode);

//        Page<MyRegisterVo>  myRegister=myRegisterService.selectMyRegister(new Page<>(page, size),"d6c13b8f-2ce5-47c2-ae95-5850abf9e318");
        Page<MyRegisterVo>  myRegister=myRegisterService.selectMyRegister(new Page<>(page, size),itemcode);
        if(myRegister.getSize()<=0)new DataGridView(-1,null);
        log.info("查询我的挂号："+myRegister.getRecords().toString());
        return new DataGridView(200,myRegister.getRecords());
    }

}
